package com.d3works.apps.production.web;

import com.d3works.apps.production.db.MpsWeeklySchedule;
import com.d3works.apps.production.service.MpsWeeklyScheduleService;
import com.d3works.inject.Beans;
import com.d3works.rpc.ActionRequest;
import com.d3works.rpc.ActionResponse;
import com.google.inject.Singleton;

@Singleton
public class MpsWeeklyScheduleController {

  public void countTotalHours(ActionRequest request, ActionResponse response) {

    MpsWeeklySchedule mpsWeeklySchedule = request.getContext().asType(MpsWeeklySchedule.class);
    Beans.get(MpsWeeklyScheduleService.class).countTotalHours(mpsWeeklySchedule);
    response.setValue("totalHours", mpsWeeklySchedule.getTotalHours());
  }
}
